package models;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import play.db.jpa.Model;

@Entity
public class App extends Model {
	public String name;
	public String icon;
	//app开发的作者
	
	@ManyToMany
	public List<User> author;
	
	public String description;
	//Category category;
	//demo的地址
	public String demo;
	//下载的地址
	public String download;
	//后期增加下载的次数统计；
	//审核是否通过：1为通过，0为审核失败；null为审核之中
	public String verified;
	
	public App(String name,String description){
		this.name=name;
		this.description=description;
		this.author= new ArrayList<User>();
	}
	
	public App addUser(User user){
		this.author.add(user);
		this.save();
		return this;
	}
}
